<template>
  <view class="personal-center">
    <!-- 顶部栏 -->
    <view class="header">
		<view class="information" @click="goToCompanyInfo">
		  <image class="avatar" src="https://zhimao.shengdunyun.net/uploads/wangeditor/20250308/67cbf1b8b89f9.png"></image>
		  <text class="company-name">{{ companyName }}</text>
		  <text class="arrow" >></text>
		</view>
    
		<!-- 订单管理、消息中心、收藏 -->
		<view class="quick-actions">
		  <view class="action-item" @click="goToOrderManagement">
			<text class="action-count">{{ orderCount }}</text>
			<text class="action-text">订单管理</text>
		  </view>
		  <view class="action-item" @click="goToMessageCenter">
			<text class="action-count">{{ messageCount }}</text>
			<text class="action-text">消息中心</text>
		  </view>
		  <view class="action-item" @click="goToFavorites">
			<text class="action-count">{{ favoriteCount }}</text>
			<text class="action-text">收藏</text>
		  </view>
		</view>
	</view>

    <!-- 暂无在线职位、发布管理 -->
    <view class="job-management card">
      <text class="job-text">{{ hasJobs ? `发布职位数：${jobCount}` : '暂无在线职位' }}</text>
      <text class="job-text publish" @click="goToPublishManagement">发布管理</text>
    </view>

    <!-- 常用功能 -->
    <view class="common-functions card">
      <text class="section-title">常用功能</text>
      <view class="function-grid">
        <view class="function-item" @click="goToCompanyHome">
		  <image src="https://zhimao.shengdunyun.net/uploads/wangeditor/20250313/67d27c64e7843.png"></image>
          <text class="function-text">公司主页</text>
        </view>
        <view class="function-item" @click="goToResume">
			<image src="https://zhimao.shengdunyun.net/uploads/wangeditor/20250313/67d27c64ed226.png"></image>
          <text class="function-text">应聘简历</text>
        </view>
        <view class="function-item" @click="goToInterviewInvitation">
			<image src="https://zhimao.shengdunyun.net/uploads/wangeditor/20250313/67d27c64edd31.png"></image>
          <text class="function-text">邀请面试</text>
        </view>
        <view class="function-item" @click="goToMyPackage">
			<image src="https://zhimao.shengdunyun.net/uploads/wangeditor/20250313/67d27c64ef3e4.png"></image>
          <text class="function-text">我的套餐</text>
        </view>
      </view>
    </view>

    <!-- 其他功能 -->
    <view class="other-functions card">
      <view class="section-header">
        <text class="section-title">其他功能</text>
        <text class="view-all" @click="viewAllFunctions">查看全部 > </text>
      </view>
      <view class="function-grid">
        <view class="function-item" @click="goToWhoIViewed">
		  <image src="/static/img/look1.svg"></image>
          <text class="function-text">我看过谁</text>
        </view>
        <view class="function-item" @click="goToWhoViewedMe">
			<image src="/static/img/look2.svg"></image>
          <text class="function-text">谁看过我</text>
        </view>
        <view class="function-item" @click="goToAccountManagement">
			<image src="/static/img/log.svg"></image>
          <text class="function-text">账号管理</text>
        </view>
        <view class="function-item" @click="goToSettings">
			<image src="/static/img/set.svg"></image>
          <text class="function-text">设置</text>
        </view>
        <view class="function-item" @click="goToOrderManagement">
			<image src="/static/img/order.svg"></image>
          <text class="function-text">订单管理</text>
        </view>
        <view class="function-item" @click="goToFeedback">
			<image src="/static/img/feedback.svg"></image>
          <text class="function-text">意见反馈</text>
        </view>
        <view class="function-item" @click="goToCustomerService">
			<image src="/static/img/service.svg"></image>
          <text class="function-text">在线客服</text>
        </view>
        <view class="function-item" @click="goToFavorites">
			<image src="/static/img/collect.svg"></image>
          <text class="function-text">收藏</text>
        </view>
      </view>
    </view>

    <!-- 退出登录 -->
    <view class="logout" @click="logout">
      <text class="logout-text">退出登录</text>
    </view>

    <!-- 底部导航栏 -->
    <BottomNav :activeTab="activeTab" />
  </view>
</template>

<script>
import BottomNav from "@/components/BottomNav.vue"; // 引入组件
export default {
	components: {
		BottomNav, // 注册组件
	  },
  data() {
    return {
	  activeTab: "mine", // 当前选中的选项卡
      companyName: "佛山市知水尚远网络科技有限公司",
      orderCount: 5, // 订单数量
      messageCount: 3, // 消息数量
      favoriteCount: 10, // 收藏数量
      hasJobs: false, // 是否有在线职位
      jobCount: 0, // 发布职位数
    };
  },
  methods: {
    // 跳转到个人资料页面
    goToProfile() {
      uni.navigateTo({ url: "/pages/profile" });
    },
    // 跳转到企业信息页面
    goToCompanyInfo() {
      uni.navigateTo({ url: "/pages/form/company-info/index" });
    },
    // 跳转到订单管理页面
    goToOrderManagement() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/order-management" });
    },
    // 跳转到消息中心页面
    goToMessageCenter() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/message-center" });
    },
    // 跳转到收藏页面
    goToFavorites() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/favorites" });
    },
    // 跳转到发布管理页面
    goToPublishManagement() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/publish-management" });
    },
    // 跳转到公司主页
    goToCompanyHome() {
      uni.navigateTo({ url: "/pages/form/company-home/index" });
    },
    // 跳转到应聘简历页面
    goToResume() {
      uni.navigateTo({ url: "/pages/resume" }); 
    },
    // 跳转到邀请面试页面
    goToInterviewInvitation() {
      uni.navigateTo({ url: "/pages/enterprise/invitation" });
    },
    // 跳转到我的套餐页面
    goToMyPackage() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/my-package" });
    },
    // 跳转到我看过谁页面
    goToWhoIViewed() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/who-i-viewed" });
    },
    // 跳转到谁看过我页面
    goToWhoViewedMe() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/who-viewed-me" });
    },
    // 跳转到账号管理页面
    goToAccountManagement() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/account-management" });
    },
    // 跳转到设置页面
    goToSettings() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/settings" });
    },
    // 跳转到意见反馈页面
    goToFeedback() {
      uni.navigateTo({ url: "/pages/enterprise/personal-center/feedback" });
    },
    // 跳转到在线客服页面
    goToCustomerService() {
      uni.navigateTo({ url: "/pages/customer-service" });
    },
    // 查看全部功能
    viewAllFunctions() {
      uni.navigateTo({ url: "/pages/all-functions" });
    },
    // 退出登录
    logout() {
      uni.showModal({
        title: "提示",
        content: "确定要退出登录吗？",
        success: (res) => {
          if (res.confirm) {
            uni.navigateTo({ url: "/pages/login" });
          }
        },
      });
    },
   /* // 底部导航栏跳转
    goToHome() {
      uni.switchTab({ url: "/pages/home" });
    },
    goToInternship() {
      uni.switchTab({ url: "/pages/internship" });
    },
    goToTalentSearch() {
      uni.switchTab({ url: "/pages/talent-search" });
    },
	goToInterviewInvitation() {
	  uni.redirectTo({ url: "/pages/interview-invitation/index" });
	},
    goToPersonalCenter() {
      uni.switchTab({ url: "/pages/personal-center/index" });
    }, */
  },
};
</script>

<style scoped>
.personal-center {
  font-family: Arial, sans-serif;
  background-color: #f5f5f5;
  padding-bottom: 60px; /* 为底部导航栏留出空间 */
}

.header {
  display: block;
  padding: 10px 20px;
  background-color: #fff;
}

.information{
	display: flex;
	align-items: center;
	margin-bottom: 10px;
}

.avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin-right: 10px;
}

.company-name {
  flex: 1;
  font-size: 18px;
  font-weight: bold;
  color: #333;
}

.arrow {
  font-size: 24px;
  color: #333;
  cursor: pointer;
}

.quick-actions {
  display: flex;
  justify-content: space-around;
  margin: 10px 0;
}

.action-item {
  text-align: center;
}

.action-count {
  display: block;
  font-size: 18px;
  color: #007aff;
}

.action-text {
  font-size: 14px;
  color: #666;
}

.card{
	background-color: #fff;
	margin:5px 10px 0;
	border-radius: 5px;
	border: 1px solid #FAFAFA;
	padding: 10px;
	align-items: center; /* 垂直居中 */
}

.job-management {
  display: flex;
  justify-content: space-between;
}

.job-text {
  font-size: 14px;
  color: #666;
}

.publish {
  color: #007aff;
  cursor: pointer;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-title {
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.view-all {
  font-size: 14px;
  color: #007aff;
  cursor: pointer;
}

.function-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.function-item {
  width: calc(25% - 10px);
  background-color: #fff;
  padding: 5px;
  text-align: center;
}

.function-text {
  font-size: 13px;
  color: #343434;
}

.common-functions image{
	display: block;
	width: 40px;
	height: 40px;
	margin: 0 auto;
}

.other-functions image{
	display: block;
	width: 30px;
	height: 30px;
	margin: 0 auto;
}

.logout {
  width: 355px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #ececec;
  border-radius: 32px;
  padding: 10px;
  margin: 40px auto;
}

.logout-text {
  font-size: 14px;
  color: #333;
}

.bottom-nav {
  display: flex;
  justify-content: space-around;
  background-color: #fff;
  padding: 10px 0;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  border-top: 1px solid #ccc;
}

.nav-item {
  text-align: center;
  cursor: pointer;
}

.nav-text {
  font-size: 14px;
  color: #666;
}
</style>